Skip to content

Support MDX docs from manifests#120

Merged
JReinhold merged 19 commits into
mainfrom
support-docs-manifest-entries
Jan 8, 2026
Merged

Support MDX docs from manifests#120
JReinhold merged 19 commits into
mainfrom
support-docs-manifest-entries

Conversation

@JReinhold
Copy link
Copy Markdown
Contributor

@JReinhold JReinhold commented Jan 5, 2026

Companion PR in core: storybookjs/storybook#33408

This PR adds support for the new docs entries in manifests, that addon-docs now adds based on MDX files. It's not required, so it will still support Storybooks that don't use addon-docs.

See the following tests for how this is outputted to the LLM:

Breaking Changes

This PR introduces a number of minor breaking changes to @storybook/mcp:

  1. The lower level tool adder functions have been renamed:
    1. addGetComponentDocumentationTool -> addGetDocumentationTool
    2. addListAllComponentsTool -> addListAllDocumentationTool
  2. The optional tool hooks have been renamed:
    1. onListAllComponents -> onListAllDocumentation
    2. onGetComponentDocumentation -> onGetDocumentation
  3. The exported MANIFEST_PATH constant have been removed in favor of two new constants, COMPONENT_MANIFEST_PATH and DOCS_MANIFEST_PATH

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jan 5, 2026

🦋 Changeset detected

Latest commit: 861b5a4

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

💥 An error occurred when fetching the changed packages and changesets in this PR
Some errors occurred when validating the changesets config:
The package or glob expression "@storybook/mcp-eval*" is specified in the `ignore` option but it is not found in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jan 5, 2026

npm i https://pkg.pr.new/storybookjs/mcp/@storybook/addon-mcp@120
npm i https://pkg.pr.new/storybookjs/mcp/@storybook/mcp@120

commit: 861b5a4

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 5, 2026

Codecov Report

❌ Patch coverage is 92.78351% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.70%. Comparing base (7b85cb0) to head (861b5a4).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
packages/mcp/src/utils/get-manifest.ts 85.00% 0 Missing and 3 partials ⚠️
packages/addon-mcp/src/mcp-handler.ts 66.66% 1 Missing ⚠️
packages/addon-mcp/src/preset.ts 0.00% 0 Missing and 1 partial ⚠️
...kages/mcp/src/utils/manifest-formatter/markdown.ts 88.88% 0 Missing and 1 partial ⚠️
packages/mcp/src/utils/manifest-formatter/xml.ts 91.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #120      +/-   ##
==========================================
+ Coverage   87.82%   88.70%   +0.88%     
==========================================
  Files          19       21       +2     
  Lines         427      478      +51     
  Branches      122      134      +12     
==========================================
+ Hits          375      424      +49     
- Misses          8        9       +1     
- Partials       44       45       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JReinhold JReinhold marked this pull request as ready for review January 5, 2026 15:32
Copilot AI review requested due to automatic review settings January 5, 2026 15:32
@JReinhold JReinhold self-assigned this Jan 5, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for MDX-based documentation entries in component manifests, allowing Storybook's addon-docs to provide standalone and component-attached documentation via the MCP protocol. The changes include breaking renames of tool functions and handlers to reflect the broader scope beyond just components.

Key changes:

  • Adds DocsManifestMap type and parallel fetching of both component and docs manifests
  • Renames tools from list-all-components/get-component-documentation to list-all-documentation/get-documentation
  • Implements extractDocsSummary utility to parse MDX content for list previews
  • Updates all formatters (XML/Markdown) to support docs entries

Reviewed changes

Copilot reviewed 49 out of 50 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pnpm-workspace.yaml, pnpm-lock.yaml Updates Storybook dependencies to 10.2.0-alpha.10 to support new manifest features
packages/mcp/src/types.ts Adds Doc, DocsManifestMap, AllManifests types; renames handlers from onListAllComponents/onGetComponentDocumentation to onListAllDocumentation/onGetDocumentation
packages/mcp/src/utils/get-manifest.ts Refactors getManifestgetManifests to fetch both component and docs manifests in parallel; splits MANIFEST_PATH into COMPONENT_MANIFEST_PATH and DOCS_MANIFEST_PATH
packages/mcp/src/utils/manifest-formatter/*.ts Adds formatDocsManifest and extractDocsSummary; renames formatComponentManifestMapToListformatManifestsToLists to handle both manifest types
packages/mcp/src/tools/*.ts Renames list-all-componentslist-all-documentation and get-component-documentationget-documentation; updates to handle both component and docs entries
packages/mcp/src/index.ts Updates exports to reflect renamed functions and constants
packages/mcp/fixtures/small-docs-manifest.fixture.json Adds test fixture for docs manifest
packages/mcp/bin.ts Updates CLI args from --manifestPath to --componentManifestPath and adds --docsManifestPath
packages/addon-mcp/src/*.ts Updates addon to use renamed tools/handlers and check for experimental_manifests preset instead of experimental_componentManifestGenerator
packages/addon-mcp/src/template.html Updates tool name in UI template
apps/internal-storybook/stories/*.mdx Adds example MDX documentation files for testing
apps/internal-storybook/tests/*.test.ts Updates E2E tests with new tool names and adds docs manifest validation
eval/**, README.md, .github/instructions/*.md Updates documentation and configuration to reflect breaking changes
.changeset/*.md Documents breaking changes for both packages
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The diff is "wrong" here, this is not a new file, but just the get-component-documentation renamed and changed.

Comment on lines +112 to +115
return dedent`# ${doc.title}

${doc.content}`;
},
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first line here might be unnecessary/redundant, adding the title? We could also just assume that MDX files always has a # title?

Copilot AI review requested due to automatic review settings January 5, 2026 15:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 50 out of 51 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment thread eval/lib/collect-args.ts Outdated
@JReinhold JReinhold mentioned this pull request Jan 6, 2026
Copilot AI review requested due to automatic review settings January 6, 2026 16:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 50 out of 51 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Copy link
Copy Markdown
Contributor

@valentinpalkovic valentinpalkovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Left some small comments. Please clean up the pnpm-lock.yaml file. (Remove the experiments)

Comment thread .changeset/large-carrots-judge.md
Comment thread .changeset/stale-ducks-pay.md
Comment thread eval/lib/collect-args.ts Outdated
Comment thread packages/addon-mcp/README.md Outdated
@JReinhold JReinhold merged commit c1fc816 into main Jan 8, 2026
11 checks passed
@JReinhold JReinhold deleted the support-docs-manifest-entries branch January 8, 2026 13:20
@storybook-app-bot storybook-app-bot Bot mentioned this pull request Jan 8, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 8, 2026

Bundle Report

Changes will increase total bundle size by 6.68kB (14.05%) ⬆️⚠️, exceeding the configured threshold of 5%.

Bundle name Size Change
@storybook/mcp-esm 32.63kB 6.62kB (25.47%) ⬆️⚠️
@storybook/addon-mcp-esm* 21.57kB 52 bytes (0.24%) ⬆️

ℹ️ *Bundle size includes cached data from a previous commit

Affected Assets, Files, and Routes:

view changes for bundle: @storybook/mcp-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
index.js 3.63kB 22.11kB 19.67% ⚠️
index.d.ts 2.99kB 10.52kB 39.71% ⚠️
view changes for bundle: @storybook/addon-mcp-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
preset.js 52 bytes 21.57kB 0.24%

Files in preset.js:

  • ./src/tools/is-manifest-available.ts → Total Size: 472 bytes

  • ./src/template.html → Total Size: 5.0kB

  • ./src/preset.ts → Total Size: 1.76kB

  • ./src/mcp-handler.ts → Total Size: 3.86kB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants